<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    function DivTag() {
        this.DOM = document.createElement('div');  //先在本文档创建一个div元素
        this.appendTo = function (node) {      //node 节点
            node.appendChild(this.DOM);
            return this;
        };
        this.css = function (option) {
            for (var k in option) {
                this.DOM.style[k] = option[k];
            }
            return this;
        }
    }
    new DivTag().appendTo(document.body).css({
        border: '1px solid yellow',
        width: '400px',
        height: '300px',
        backgroundColor: 'red',
        margin: '100px auto'
    });
</script>
</html>